package controller.PurchaseTable;

import entity.MsgResult;
import entity.purchase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.DeletePurchaseService;

import java.util.Date;

@Controller
public class DeletePurchaseController {
    @Autowired
    private DeletePurchaseService deletePurchaseService;

    @RequestMapping("/deletePurchase")
    @ResponseBody
    public MsgResult deletePurchase(purchase purchase){
        MsgResult msgResult = new MsgResult();
        System.out.println(purchase.getpId());
        boolean b = deletePurchaseService.deletePurchase(purchase.getpId());
        if(b){
            msgResult.setFlag(1);
            msgResult.setMsg("删除进货记录成功");
            return msgResult;
        }
        msgResult.setFlag(0);
        msgResult.setMsg("删除进货记录失败");
        return msgResult;
    }
}
